﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Entities;
using BusinessLogic.ProfileManagementLogic;

namespace MockProjectGroupThree.Presentation.ProfileManagement
{
    public partial class AddNewClient : System.Web.UI.Page
    {
        private Client client = null;
        ClientProfileManagementLogic clientProfile=new ClientProfileManagementLogic();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void buttonSave_Click(object sender, EventArgs e)
        {
            client = new Client
                         {
                             UserName = textUserName.Text,
                             CompanyName = textCompany.Text,
                             Address = textAddress.Text,
                             PhoneNumber = int.Parse(textPhoneNumber.Text),
                             Email = textEmail.Text
                         };
            var result = clientProfile.InsertClient(client);
            if(result>0)
            {
                Response.Redirect("ClientManager.aspx");
            }
        }

        protected void buttonReset_Click(object sender, EventArgs e)
        {
            textCompany.Text = "";
            textEmail.Text = "";
            textAddress.Text = "";
            textPhoneNumber.Text = "";
        }
    }
}
